Skip to content

feat: add supported_scopes method and scope: :all shorthand#109

Merged
simonx1 merged 3 commits intomainfrom
feature/supported-scopes
Mar 22, 2026
Merged

feat: add supported_scopes method and scope: :all shorthand#109
simonx1 merged 3 commits intomainfrom
feature/supported-scopes

Conversation

@simonx1
Copy link
Owner

@simonx1 simonx1 commented Mar 20, 2026

Summary

Closes #107

Adds a public API for discovering and using all scopes supported by the OAuth authorization server, eliminating the need to call private methods.

Changes

OAuthProvider

  • Added public supported_scopes method — returns Array<String> of scopes from server discovery, or [] if the server does not advertise scopes. Result is memoized.
  • Added scope: :all shorthand — when scope is set to the symbol :all, it is resolved lazily during start_authorization_flow to supported_scopes.join(" ") without mutating @scope.

Before / After

Before:

provider.scope = provider.send(:discover_authorization_server).scopes_supported.join(" ")
provider.start_authorization_flow

After:

# Option A — explicit
provider.scope = provider.supported_scopes.join(" ")
provider.start_authorization_flow

# Option B — shorthand
provider = MCPClient::Auth::OAuthProvider.new(
  server_url: url,
  redirect_uri: uri,
  scope: :all
)
provider.start_authorization_flow

Tests

  • supported_scopes returns array from server metadata
  • supported_scopes returns [] when scopes_supported is nil
  • scope: :all resolves correctly during authorization flow
  • All existing specs pass

Branch: feature/supported-scopes
URL: https://github.com/simonx1/ruby-mcp-client/pull/new/feature/supported-scopes

)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@chatgpt-codex-connector
Copy link

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@simonx1 simonx1 merged commit 88cf051 into main Mar 22, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

How to send all scopes

2 participants